package org.dftproject.lineagelinkage.utils;

/**
 * @author Steve
 * @invariant 
 */
public class Pair<A, B> {

	public A left;
	public B right;
	
	/**
	 * Constructor
	 * @pre 
	 * @post the object is created
	 */
	public Pair() {
		super();
		left = null;
		right = null;
	}

	/**
	 * Constructor
	 * @param left
	 * @param right
	 * @pre 
	 * @post the object is created
	 */
	public Pair(A left, B right) {
		super();
		this.left = left;
		this.right = right;
	}

	/**
	 * Getter for the left
	 * @return the left
	 * @pre none
	 * @post result is not null
	 */
	public A getLeft() {
		return left;
	}

	/**
	 * Setter for the left
	 * @param left the left to set
	 * @pre left != null
	 * @post the left is set on this instance
	 */
	public void setLeft(A left) {
		this.left = left;
	}

	/**
	 * Getter for the right
	 * @return the right
	 * @pre none
	 * @post result is not null
	 */
	public B getRight() {
		return right;
	}

	/**
	 * Setter for the right
	 * @param right the right to set
	 * @pre right != null
	 * @post the right is set on this instance
	 */
	public void setRight(B right) {
		this.right = right;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		String a = "null";
		String b = "null";
		if(left != null){
			a = left.toString();
		}
		if(right != null){
			b = right.toString();
		}
		return "(" + a + ", " + b + ")";
	}
}
